<template>
    <div style="padding: 10px;">
        <el-form :model="formData" ref="queryForm" class="queryForm" :inline="true" :rules="Rules" label-width="auto"
                 @submit.native.prevent>
            <el-form-item label="字段类型" desc="字段类型" prop="fieldType">
                <dic-select v-model="formData.fieldType" :code="dicInner.mes_bpm_form_fieldType"
                            placeholder="字段类型" clearable size="small" style="width:120px;" />
            </el-form-item>
            <el-form-item label="表达式" desc="表达式" prop="expression">
                <el-input v-model.trim="formData.expression" placeholder="表达式" clearable size="small"
                          style="width:120px;" />
            </el-form-item>
         <!--   <el-form-item label="状态" desc="状态 1 正常  5暂停 10废除" prop="state">
                <dic-select v-model="formData.state" :code="dicInner.mes_bpm_condition_expression_state"
                            placeholder="状态 1 正常  5暂停 10废除" clearable size="small" style="width:120px;" />
            </el-form-item>-->
        </el-form>
    </div>
</template>
<script>  import { getUrlParam } from '@/utils/index';
import { alertWithPaylod } from '@/utils/alertUtil';
import * as  api from '@/apis/mesBpmConditionExpression.api.js';
import { default as FormDialog } from '@codegenarate/mydialogplus';
import { fillData, validatePromise } from '@/utils/index';

const Rules = {
  'id': [{ required: false, message: '主键ID', trigger: 'blur' }],
  'fieldType': [{ required: true, message: '字段类型', trigger: 'blur' }],
  'expression': [{ required: true, message: '表达式', trigger: 'blur' }],
  'state': [{ required: false, message: '状态', trigger: 'blur' }],
  'remarks': [{ required: false, message: '备注', trigger: 'blur' }],
  'tenantType': [{ required: false, message: '租户类型', trigger: 'blur' }],
  'tenantId': [{ required: false, message: '租户ID', trigger: 'blur' }],
  'delState': [{ required: false, message: '有效状态[数据字典=del_state]', trigger: 'blur' }],
  'addUser': [{ required: false, message: '添加人', trigger: 'blur' }],
  'addUserId': [{ required: false, message: '添加人ID', trigger: 'blur' }],
  'addTime': [{ required: false, message: '添加时间', trigger: 'blur' }],
  'editUser': [{ required: false, message: '最近更新人', trigger: 'blur' }],
  'editUserId': [{ required: false, message: '最近更新人ID', trigger: 'blur' }],
  'lastEditTime': [{ required: false, message: '最近更新时间', trigger: 'blur' }],
  'serverNumber': [{ required: false, message: '服务器编号ID', trigger: 'blur' }],
};
const dicInner = {
  mes_bpm_form_fieldType: 'mes_bpm_form_fieldType',
  '___mes_bpm_condition_expression_id': '主键ID',
  'mes_bpm_condition_expression_id': 'mes_bpm_condition_expression_id',
  '___mes_bpm_condition_expression_fieldType': '字段类型',
  'mes_bpm_condition_expression_fieldType': 'mes_bpm_condition_expression_fieldType',
  '___mes_bpm_condition_expression_expression': '表达式',
  'mes_bpm_condition_expression_expression': 'mes_bpm_condition_expression_expression',
  '___mes_bpm_condition_expression_state': '状态 1 正常  5暂停 10废除',
  'mes_bpm_condition_expression_state': 'mes_bpm_condition_expression_state',
  '___mes_bpm_condition_expression_remarks': '备注',
  'mes_bpm_condition_expression_remarks': 'mes_bpm_condition_expression_remarks',
  '___mes_bpm_condition_expression_tenantType': '租户类型 1应用管理者2应用消息者',
  'mes_bpm_condition_expression_tenantType': 'mes_bpm_condition_expression_tenantType',
  '___mes_bpm_condition_expression_tenantId': '租户ID',
  'mes_bpm_condition_expression_tenantId': 'mes_bpm_condition_expression_tenantId',
  '___mes_bpm_condition_expression_delState': '有效状态[数据字典=del_state] 1有效  5删除',
  'mes_bpm_condition_expression_delState': 'mes_bpm_condition_expression_delState',
  '___mes_bpm_condition_expression_addUser': '添加人',
  'mes_bpm_condition_expression_addUser': 'mes_bpm_condition_expression_addUser',
  '___mes_bpm_condition_expression_addUserId': '添加人ID',
  'mes_bpm_condition_expression_addUserId': 'mes_bpm_condition_expression_addUserId',
  '___mes_bpm_condition_expression_addTime': '添加时间',
  'mes_bpm_condition_expression_addTime': 'mes_bpm_condition_expression_addTime',
  '___mes_bpm_condition_expression_editUser': '最近更新人',
  'mes_bpm_condition_expression_editUser': 'mes_bpm_condition_expression_editUser',
  '___mes_bpm_condition_expression_editUserId': '最近更新人ID',
  'mes_bpm_condition_expression_editUserId': 'mes_bpm_condition_expression_editUserId',
  '___mes_bpm_condition_expression_lastEditTime': '最近更新时间',
  'mes_bpm_condition_expression_lastEditTime': 'mes_bpm_condition_expression_lastEditTime',
  '___mes_bpm_condition_expression_serverNumber': '服务器编号ID',
  'mes_bpm_condition_expression_serverNumber': 'mes_bpm_condition_expression_serverNumber',
};
export default {
  name: 'mesBpmConditionExpressionlist',
  data() {
    return {
      api: api,
      Rules,
      dicInner,
      formData: {
        'id': '',
        'fieldType': '',
        'expression': '',
        'state': '',
        'remarks': '',
        'tenantType': '',
        'tenantId': '',
        'delState': '',
        'addUser': '',
        'addUserId': '',
        'addTime': '',
        'editUser': '',
        'editUserId': '',
        'lastEditTime': '',
        'serverNumber': '',
      },
      lists: [],
      selectRows: [],
      classId: '',
      classIdPath: '',
      className: '',
      loading: false,
      isFold: false,
      tableRowClassName({ row, rowIndex }) {
        if (row.rowType == 'total') {
          return 'total-row';
        }
        return '';
      },
    };
  },
  components: {
    svgIcon: () => import('@codegenarate/svg-icon'),
    dicSelect: () => import('@/components/dicselect.vue'),
    dicTag: () => import('@/components/DicSelect/dic-tag.vue'),
  },
  computed: {},
  watch: {},
  methods: {
    /**       *  @params _data.         * @desc 初始化        */
    initByDialog(_data) {
      fillData(this.formData, _data);
      console.log('初始化数据', this.formData);
    },
    async submitByDialog(_data) {
      var isyes = await validatePromise.call(this, 'queryForm');
      if (!isyes) {
        return { success: false, message: '请检查必填项' };
      }
      var func = this.formData.id ? api.update : api.add;
      var result = await func(this.formData);
      alertWithPaylod(result);
      return result;
    },
  },
};</script>
